<!doctype html>
<html lang="en">
<head>
    <title>登录到ranter水果店</title>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="css/bootstrap.css">
    <style>
        .form-signin {
            max-width: 330px;
            padding: 15px;
            margin: 0 auto;
        }
        h2 {
            color: #76ac25;
        }
    </style>
</head>
<body>
<div class="container">
    <form class="form-signin">
        <h2 class="form-signin-heading">欢迎登录</h2>
        <label for="inputUserName" class="sr-only">账号</label>
        <input  name="UserName" style="margin-bottom: 20px;" type="text" id="inputEmail" class="form-control" placeholder="账号" required="" autofocus="">
        <label for="inputPassword" class="sr-only">密码</label>
        <input name="PassWord" type="password" id="inputPassword" class="form-control" placeholder="密码" required="">
        <div class="checkbox">
            <label>
                <input type="checkbox" value="remember-me">记住密码
            </label>
        </div>
        <button id="tijiao" class="btn btn-lg btn-success btn-block" type="button">登录</button>
    </form>
</div>

<script src="js/jquery-3.2.0.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>-->
<script src="js/bootstrap.js"></script>
<script>
    $("#tijiao").click(function(){
        $.post('/log',{
            "UserName": $("[name='UserName']").val(),
            "PassWord": $("[name='PassWord']").val()
        },function(result){
            console.log(result);
            if (result === "1"){
                alert("登录成功!");
                window.location.href="/";
            }else{
                alert("登录失败!")
            }
        })
    });
</script>
</body>
</html>